<template>
  <div class="full-box shadow-box padding-box">
    <OperateCommon :showSearch="true" @search="initData">
      <template #condition>
        <div class="condition-item">
          <el-select
            v-model="queryParams.assign_status"
            value-key=""
            placeholder=""
            clearable
            filterable
          >
            <el-option :key="-1" label="全部" value=""></el-option>
            <el-option :key="0" label="暂存" :value="0"></el-option>
            <el-option :key="1" label="待反馈" :value="10"></el-option>
            <el-option :key="2" label="待审核" :value="20"></el-option>
            <el-option :key="3" label="已退回" :value="30"></el-option>
            <el-option :key="4" label="处置完毕" :value="100"></el-option>
          </el-select>
        </div>
      </template>
    </OperateCommon>
    <div class="table-wrapper">
      <BaseTable
        :showSort="true"
        :columns="columns"
        :tableData="tableData"
        :pages="{
          show: true,
          count: count,
        }"
        :operate="{
          show: true,
          width: 150,
        }"
        @pagination="pageChange"
      >
        <template #operate="{ current }">
          <el-button type="primary" size="mini" @click="linkToDetails(current)"
            >详情</el-button
          >
        </template>
      </BaseTable>
    </div>
  </div>
</template>

<script>
import BaseTable from "@/components/Common/BaseTable.vue";
import { getCheckAndRectifyList } from "@/api/CheckAndRectify/Index";
import typeMixin from "./typeMixin";
import OperateCommon from "@/components/Common/OperateCommon.vue";
import { questionToDetail } from "@/utils/typeHelper";
import commonList from "@/mixins/commonList";
export default {
  mixins: [typeMixin, commonList],
  components: { BaseTable, OperateCommon },
  data() {
    return {
      columns: columns,
      tableData: [],
      count: 0,
      queryParams: {
        pageNum: 1,
        pageSize: 20,
        assign_status: 20,
      },
    };
  },
  methods: {
    questionToDetail,
    initData() {
      getCheckAndRectifyList(this.queryParams).then((res) => {
        if (res.code == 0) {
          this.tableData = res.data;
          this.count = res.num;
        }
      });
    },
    linkToDetails(val) {
      this.$router.push(this.questionToDetail(val, 2));
    },
    pageChange(val) {
      this.queryParams.pageNum = val.pageNum;
      this.queryParams.pageSize = val.pageSize;
      this.initData();
    },
  },
  created() {
    this.initData();
  },
};
const columns = [
  {
    prop: "mend_code",
    label: "整改单编号",
    width: "",
    minWidth: "200",
    align: "",
  },
  {
    prop: "object_name",
    label: "项目名称",
    width: "",
    minWidth: "300",
    align: "",
  },
  {
    prop: "problem_type",
    label: "问题分类",
    width: "150",
    minWidth: "",
    align: "",
  },
  {
    prop: "repeat_count",
    label: "重复次数",
    width: "100",
    minWidth: "",
    align: "",
  },
  {
    prop: "inspect_unit",
    label: "检查单位",
    width: "200",
    minWidth: "",
    align: "",
  },
  {
    prop: "regist_date",
    label: "登记日期",
    width: "150",
    minWidth: "",
    align: "",
  },
  {
    prop: "status_text",
    label: "处理状态",
    width: "100",
    minWidth: "",
    align: "",
  },
];
</script>

<style lang="scss" scoped>
</style>